package com.jkd.server.encoder;

import cn.hutool.core.convert.Convert;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;

import java.util.List;

public class MyEncoder extends MessageToMessageEncoder<String> {

    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, String str, List<Object> list) throws Exception {
        byte[] command = Convert.hexToBytes(str);
        list.add(Unpooled.wrappedBuffer(command));
    }

}
